
const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {

    @property(cc.Button)
    private closeBtn:cc.Button = null;

    @property(cc.ProgressBar)
    private progBar:cc.ProgressBar = null;

    @property(cc.ProgressBar)
    private progBarY:cc.ProgressBar = null;

    // onLoad () {}

    start () {
        this.closeBtn.node.on(cc.Node.EventType.TOUCH_END,this.remove,this);
    }

    update (dt) {
        var progress = this.progBar.progress;
        if (progress < 1) {
            progress += dt;
        }
        else {
            progress = 0;
        }
        this.progBar.progress = progress;
        this.progBarY.progress = progress;
    }

    private remove():void
    {   
        this.closeBtn.node.off(cc.Node.EventType.TOUCH_END,this.remove,this); 
        this.node.destroy();
    }
}
